Workflow API Reference
TheWorkflow class represents an executable workflow definition in BindAI.
A workflow organizes nodes into an execution graph, allowing agents, tools, conditions, loops, parallel branches, human tasks, retries, and scheduling to work together as a single automated process.
This page documents the public Workflow API.
Overview
A workflow coordinates execution between multiple nodes. Conceptually:Creating a Workflow
Workflows are typically created using theWorkflowBuilder.
Example:
Workflow Components
A workflow generally contains:- workflow identifier
- workflow name
- nodes
- start node
- workflow context
- registered agents
- execution metadata
WorkflowBuilder
The builder provides a fluent interface for constructing workflows. Typical methods include:
The builder simplifies workflow construction while preventing invalid structures.
Executing a Workflow
A workflow is executed through its executor. Example:Workflow Context
Every execution receives a workflow context. Conceptually:Workflow Variables
Nodes communicate through workflow variables. Example:Registered Agents
A workflow may contain one or more registered agents.Workflow Nodes
A workflow is composed of nodes. Common node types include:- Start
- End
- Agent
- Condition
- Loop
- Parallel
- Human Task
Execution Graph
Nodes are connected to form a directed execution graph.Validation
Before execution, workflows should be validated. The validator checks for:- missing start node
- unreachable nodes
- invalid references
- structural errors
Workflow Result
Workflow execution returns a result object. Typical information includes:
Applications should inspect the result before using workflow outputs.
Serialization
Workflows can be serialized for storage or transport. Typical methods include:to_dict()load_dict()
Human Tasks
If a Human Task node is encountered, execution pauses.Scheduling
Workflows may be executed manually or by the scheduler.Retry and Timeout
Workflows may use execution policies such as:- RetryPolicy
- TimeoutPolicy
Best Practices
- Build workflows using
WorkflowBuilder. - Keep nodes focused on one responsibility.
- Store shared state in workflow variables.
- Validate workflows before deployment.
- Separate orchestration from AI reasoning.
- Use conditions instead of embedding business logic in prompts.
- Combine retries and timeouts for production workflows.
Related APIs
The Workflow API works closely with:- Agent
- Project
- Tool
- WorkflowBuilder
- WorkflowExecutor
Summary
TheWorkflow class defines how tasks execute within BindAI.
By organizing nodes into a validated execution graph, workflows enable sequential processing, branching, loops, parallel execution, human approval, scheduling, and other advanced orchestration patterns while keeping business logic modular and reusable.